

$(function () {
    var href = window.location.href;
    var lastIndexOf = href.lastIndexOf("=");
    var id = href.slice(lastIndexOf + 1);
    console.log(id);
    $.ajax({
        type: "get",
        url: "http://39.98.85.248:3002/artist/top/song?id="+id,
        data: "",
        dataType: "json",
        success: function (response) {
            console.log(response);
            $("body").append("<ul><ul>")
         let arr_songs = response.songs;
            arr_songs.forEach(element => {
                $("body").append("<a href=music.html?id="+element.id+">"+element.name+"</a>");
                $("body").append("<img src=" + element.al.picUrl + "></img>")
            });
        }
    });
})